﻿//using AutoMapper;
//using HamcoWcs.Contract.ContractCommon;
//using HamcoWcs.Contract.ContractMes;
//using HamcoWcs.DAL;
//using HamcoWcs.Entitys.MesMsgQueues;
//using HamcoWcs.Models.Common;
//using HamcoWcs.Models.Common.Enums;
//using HamcoWcs.Service.Common;
//using System;
//using System.Xml;

//namespace HamcoWcs.Service.Mes.Parsers
//{
//    [Obsolete]
//    [AutoInject(typeof(IMesMsgParser), InjectType.Scope)]
//    public class MesMsgParser_CurrentDateTime : MesMsgParserBase, IMesMsgParser
//    {
//        public MesMsgParser_CurrentDateTime(ILoggerService loggerService, WcsDbContext wcsDbContext, IMapper mapper) : base(loggerService, wcsDbContext, mapper)
//        {
//        }

//        public string EventName => "CURRENTDATETIME";


//        public void HandleEvent(MesMsgQueue message)
//        {
//            string dateStr = XmlHelper.GetXPathText(message.Return, "//DATETIME");

//            if (dateStr.Length != 14)
//            {
//                message.Return = "DateTime style illegal";
//                message.Status = (int)EnumMesMsgStatus.Error;
//                return;
//            }

//            bool isParse = long.TryParse(dateStr, out long mesTime);
//            if (!isParse)
//            {
//                message.Return = "DateTime style illegal";
//                message.Status = (int)EnumMesMsgStatus.Error;
//                return;
//            }

//            long wcsTime = long.Parse(DateTime.Now.ToString("yyyyMMddHHmmss"));
//            long diff = Math.Abs(mesTime - wcsTime);

//            // 差距秒超过阈值
//            if (diff > GlobalValue.SERVER_TIME_DIFF_THRESHOLD)
//            {
//                // todo 提示
//                message.Return = "remind csot check wcs server time";
//            }
//            message.Status = (int)EnumMesMsgStatus.Completed;
//        }
//    }
//}
